package com.weipeep.sys.service.impl;

import com.google.common.collect.Maps;
import com.weipeep.sys.dao.*;
import org.springframework.stereotype.Service;

import com.weipeep.sys.domain.WebUserDO;
import com.weipeep.sys.service.WebUserService;
import com.weipeep.common.base.CoreServiceImpl;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 
 * <pre>
 * 
 * </pre>
 * <small> 2018-04-20 22:33:58 | wangyun</small>
 */
@Service
public class WebUserServiceImpl extends CoreServiceImpl<WebUserDao, WebUserDO> implements WebUserService {
    @Resource
    private WebUserDao webUserDao;
    @Resource
    private DemandDao demandDao;
    @Resource
    private ProductDao productDao;
    @Resource
    private XunJiaDao xunJiaDao;
    @Resource
    private BaoJiaDao baoJiaDao;
    @Override
    public void resetPwd(WebUserDO webUserDO, WebUserDO user) {

    }

    @Override
    public boolean deleteWebUserDOById(Long id) {
        Map<String,Object> map = Maps.newHashMap();
        map.put("user_id",id);
        webUserDao.deleteById(id);
        demandDao.deleteByMap(map);
        productDao.deleteByMap(map);
        baoJiaDao.deleteByMap(map);
        xunJiaDao.deleteByMap(map);
        Map<String,Object> map1 = Maps.newHashMap();
        map1.put("to_user_id",id);
        xunJiaDao.deleteByMap(map1);
        return true;
    }

    @Override
    public void deleteBatchWebUserDOIds(List<Long> ids) {
        for (Long id:ids){
            deleteWebUserDOById(id);
        }
    }
}
